<?php
	class khoahocdata
	{
		public function Them($khoahoc_ma = "", $khoahoc_ten = "", $khoahoc_namvao="")
		{
			$sql = "INSERT INTO khoahoc(khoahoc_ma, khoahoc_ten, khoahoc_namvao)
					VALUES('$khoahoc_ma', '$khoahoc_ten','khoahoc_namvao')";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function CapNhat($khoahoc_ma = "", $khoahoc_ten = "", $khoahoc_namvao="")
		{
			$sql = "UPDATE `khoahoc` SET `khoahoc_ten` = '$khoahoc_ten', `khoahoc_namvao` WHERE khoahoc_ma = '$khoahoc_ma'";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function Xoa($khoahoc_ma = "")
		{
			$sql = "DELETE  FROM khoahoc WHERE khoahoc_ma = '$khoahoc_ma'";
			
			$service = new dataservice();
			return $service->ExecuteNonQuery($sql);
		}
		
		public function LayDanhSach($khoahoc_ma = "")
		{
			$sql = "SELECT * FROM khoahoc WHERE 1";
			
			if($khoahoc_ma != "")
				$sql .= " AND khoahoc_ma = '$khoahoc_ma'";
			
			$service = new dataservice();
			return $service->ExecuteQuery($sql);
		}
	}
?>